package com.hg.avaya.util;

import com.avaya.sce.runtimecommon.SCESession;

/**
 * @author litong
 * @date 2019-3-30-上午11:44:17
 *
 */
public class DataFormat {
  public static String sessionID = "";

  public static String replaceString(String source, String tar1, String tar2) {
    if (source != null && !"".equals(source)) {
      source = source.replaceAll(tar1, tar2);
    }
    return new String(source + "");
  }

  /*
   * 两个时间点之差，以秒为单位
   */
  public static long timeMinus(long startTime, long endTime) {
    return endTime - startTime;
  }

  /*
   * 获取sessionID
   */
  public static String getMySessionId(SCESession mySession) {
    String str = mySession.getEncodedSessionId();
    return sessionID = str.substring(0, str.indexOf("%"));
  }
}